<template>
    <div>
        <button @click='add'>
          <slot></slot>
        </button>
        {{age}}

        {{$store.state.count}}
    </div>
</template>
<script>
// @ is an alias to /src
export default {
    name: 'XXX',
    inject:['qqq','obj'],
    data() {
        return {
          age:100
        }
    },
    created() {
      // console.log(this.$parent.name = 666)
      console.log(this)
    },
    methods: {
      add(){
        // this.$store.state.count += 100
        // this.$store.commit('addCount',10);// 执行 mutations中的 addCount方法，斌且传递10这个参数过去
        // this.$store.commit({
        //   type:'addCount',
        //   num:10
        // })
        this.$store.dispatch('addCountAsync',10)
      }
    },
    components: {
        
    }
}
</script>
<style lang="less">

</style>